package org.springframework.security.access.intercept;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.context.SecurityContext;

import java.util.Collection;

/**
 * @author Dillon
 * @date 2024/6/29
 * @slogan 致敬大师 致敬未来的你
 * @desc 包装类，用于标记该请求对应的权限是否有改变
 */
@Deprecated
public class InterceptorStatusToken {

	/**
	 * 临时存储更改前的上下文
	 */
	private final SecurityContext securityContext;

	/**
	 * 当前请求对应的角色列表
	 */
	private final Collection<ConfigAttribute> attr;

	/**
	 * FilterInvocation
	 */
	private final Object secureObject;

	/**
	 * 权限是否该表
	 */
	private final boolean contextHolderRefreshRequired;

	/**
	 * 构造函数
	 *
	 * @param securityContext              认证成功实现类
	 * @param contextHolderRefreshRequired 权限是否该表
	 * @param attributes                   当前请求对应的角色列表
	 * @param secureObject                 FilterInvocation
	 */
	public InterceptorStatusToken(SecurityContext securityContext, boolean contextHolderRefreshRequired,
			Collection<ConfigAttribute> attributes, Object secureObject) {
		this.securityContext = securityContext;
		this.contextHolderRefreshRequired = contextHolderRefreshRequired;
		this.attr = attributes;
		this.secureObject = secureObject;
	}

	public Collection<ConfigAttribute> getAttributes() {
		return this.attr;
	}

	public SecurityContext getSecurityContext() {
		return this.securityContext;
	}

	public Object getSecureObject() {
		return this.secureObject;
	}

	public boolean isContextHolderRefreshRequired() {
		return this.contextHolderRefreshRequired;
	}

}
